function out = warping2(in, X, Y, X1, Y1, method)

if ~exist(method, 'var')
    method = 'linear';
end

out = interp2(Y, X, in, Y1, X1, method);
out(isnan(out)) = 0;